(Quick Reference)

create-taglib

Purpose

The create-taglib command creates a tag library and associated unit test for the given base name.

Examples

grails create-taglib
grails create-taglib book
grails create-taglib org.bookstore.Book

Description

Creates a tag library for the given base name. The argument is optional, but if you don't include it the command will ask you for the name of the tag library.

A tag library is a "view helper" that in MVC terms helps the view with rendering by providing a set of reusable tags.

The name of the tag library can include a Java package, such as org.bookstore in the final example above, but if one is not provided a default is used. So the second example will create the file grails-app/taglibs/<appname>/BookTagLib.groovy whereas the last one will create grails-app/taglibs/org/bookstore/BookTagLib.groovy directory. Note that the first letter of the tag library name is always upper-cased when determining the class name.

If you want the command to default to a different package for tag libraries, provide a value for grails.project.groupId in the runtime configuration.

Note that this command is just for convenience and you can also create tag libs in your favourite text editor or IDE if you choose.

Usage:

grails create-taglib [name]

Fired Events:

  • CreatedFile - When the tag library has been created